#include<iostream>
#include<fstream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<vector>
#include"fuction.h"
using namespace std;
const double w = 1.1;
double *a = nullptr;
double *b = nullptr;
double *ans = nullptr;
int n = 7585;
vector<string> file_deal(fstream& file){
  string line;
  vector<string> vs;
  while(getline(file, line)){
    for(int i = 0; i < line.size(); i++){
      if(line[i] == ','){
        line[i] = ' ';
      }
    }
    vs.push_back(line);
  }
  return vs;
}

int main(){
  fstream file("A.txt");
  vector<string> vs = file_deal(file);
  stringstream ss;
  for(int i = 0; i < vs.size(); i++){
    ss << vs[i];
  }
  vector<vector<double>> A_vec;
  A_vec.resize(n);
  double tmp;
  for(int i = 0; i < n; i++){
    while(ss >> tmp){
      A_vec[i].push_back(tmp);
      if(A_vec[i].size() == n) break;
    }
  }
  a=new double [n*n];
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++)
    {
      a[n*i+j]=A_vec[i][j];
    }
  }
  vector<double> b1;
  for(int i = 0; i < n; i++){
    ss >> tmp;
    b1.push_back(tmp);
  }
  b=new double[n];
  for(int i=0;i<n;i++)
  {
     b[i]=b1[i];
  }
  double *c=new double[n];
  c=SOR(a,n,b,w);
  for(int i=0;i<n;i++)
  {
    cout<<c[i]<<endl;
  }
}
